package LinkedList;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> ret = new ArrayList<>();
        List<Integer> row = new ArrayList<>();//一行
        row.add(1);//第一行的第一个数
        ret.add(row);//第一行
        for (int i = 1; i < numRows; i++) {
            List<Integer> current = new ArrayList<>();
            current.add(1);//后面这一行的第一个数是1
            List<Integer> pre = ret.get(i - 1);
            for (int j = 1; j < i; j++) {
                //[i][j] = [i-1][j] + [i-1][j-1]
                int pos = pre.get(j) + pre.get(j - 1);
                current.add(pos);
            }
            current.add(1);//后面这一行的第二个数也是
            ret.add(current);
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int row = in.nextInt();
        List<List<Integer>> list = generate(row);
        for (int i = 0; i < list.size(); i++) {
            List<Integer> curRow = list.get(i);
            for(int j = 0; j < curRow.size(); j++) {
                System.out.print(curRow.get(j));
                if(j < curRow.size() - 1) {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
